package com.ry.bhwktapp.home.ui
//定义泛型
open class FanXingClass<T> (open var field:T?= null)

//继承泛型类
class jichengFanXing(kkk:Float):FanXingClass<Float>(){
    override var field: Float?=kkk

}

fun main() {
    val int = FanXingClass<Int>(0)
    val double = FanXingClass<Double>(0.333)
    val boolean = FanXingClass<Boolean>(true)
    val jichengFanXing = jichengFanXing(3.14F)
    println("${int.field},double=$double,boolean=$boolean,jichengFanXing=$jichengFanXing")

    var arrayListOf: ArrayList<out Number> = arrayListOf(1, 1.0, 1.3f)
    val array: ArrayList<Int> = arrayListOf(1, 2, 3)
    arrayListOf = array
}


//定义泛型函数
fun<T> prentlField(name:T){
    println(name)
}


